Repository navigation
fix: apply cancel_timeout when canceling a queued sql.batch - #1336
Open
pcbeingused333 wants to merge 2 commits into
Open
pcbeingused333 wants to merge 2 commits into
pcbeingused333 wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #1318 (same area:
cancel_timeoutandsql.batch), but a different path: that PR clears a leftover timer after a batch settles; this one covers a batch that has not started yet.cancel()on a plain query that is already sent but queued behind another one callsquiet(x), so the configuredcancel_timeoutapplies.cancelBatchdid not: for a sent batch that is not first in line it only stored thecancelpromise handlers. If the query ahead never finishes (for examplepg_sleepwith a long duration), neither the batch nor itscancel()ever settles, even withcancel_timeoutset (documented in the README).cancelBatchnow callsquiet(x)before waiting, matchingcancel(). No new timeout is introduced; it restores the existing one.Test:
tests/unit/cancel.jsuses the simulated server andcancel_timeout: 0.1, with a long-running query ahead of a canceledsql.batch. Before the change the batch and the cancel promise stay pending (false,false); after, both settle (true,true). Added a CHANGELOG entry under Unreleased.This change was prepared, and the tests above were run, with the assistance of an AI coding tool.